package com.example.threadSimple;


/**
 * @Author: Ah Nan
 * @Description: 普通调用
 * @Date: 16:24 2020/6/28
 */
public class PaymentService {

    public static void main(String[] args) {
        long start = System.currentTimeMillis();
        PaymentService paymentService = new PaymentService();
        PaymentModel paymentModel = new PaymentModel();
        paymentModel.setCallUrl("www.123456");
        paymentModel.setPaymentAmount(2000);
        paymentService.submitPay(paymentModel);
        long end = System.currentTimeMillis() - start;
        System.out.println("消耗时间为："+end);
    }

    public String submitPay(PaymentModel paymentModel) {
        System.out.println("开始校验支付请求参数");
        return doPay(paymentModel);
    }

    public String doPay(PaymentModel paymentModel) {
        System.out.println("开始处理支付请求:" + paymentModel);

        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        return "success";
    }
}
